package com.fluxtah.jordl.examples.twitter;

import com.fluxtah.jordl.lib.Transformer;
import com.fluxtah.jordl.lib.TransformException;	
import org.json.JSONArray;
import org.json.JSONException;

public class TwitterUserArrayInputTransformer extends Transformer<JSONArray, TwitterUser[]> {
	public void transform(JSONArray source, TwitterUser[] target) throws TransformException {
		try {
			TwitterUserInputTransformer itemTransformer = provider.get(TwitterUserInputTransformer.class);
			for(int i=0; i < source.length(); i++) {
				itemTransformer.transform(source.getJSONObject(i), target[i]);
			}
		} catch (JSONException x) {
			throw new TransformException(x);
		}
	}
}
